package com.java.shop.product.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.java.common.utils.PageUtils;
import com.java.shop.product.entity.AttrEntity;
import com.java.shop.product.entity.AttrGroupEntity;
import com.java.shop.product.vo.AttrGroupWithAttrVo;
import com.java.shop.product.vo.AttrRelationVo;
import com.java.shop.product.webvo.SkuItemVo;

import java.util.List;
import java.util.Map;

/**
 * 
 *
 * @author cxq
 * @email 137512476@qq.com
 * @date 2021-03-26 11:19:52
 */
public interface AttrGroupService extends IService<AttrGroupEntity> {

    PageUtils queryPage(Map<String, Object> params);

    PageUtils queryPage(Map<String, Object> params, Long categoryId);

    /**
     * 自定义查询，在mapper.xml中使用了连表查询
     * @param params
     * @param categoryId
     * @return
     */
    PageUtils myQueryPage(Map<String, Object> params, Long categoryId);


    /**
     * 更新分组信息时更新其他表中关联的字段
     * @param attrGroup
     */
    void updateDetails(AttrGroupEntity attrGroup);

    /**
     * 根据属性组ID获取所对应的属性信息
     * @param attrGroupId
     * @return
     */
    List<AttrEntity> getRelationAttr(Long attrGroupId);

    /**
     * 批量删除关联数据
     * @param attrRelationVo
     */
    void deleteBatchRelation(List<AttrRelationVo> attrRelationVo);

    /**
     * 批量保存关联关系
     * @param attrRelationVo
     */
    void saveBatchRelation(List<AttrRelationVo> attrRelationVo);

    List<AttrGroupWithAttrVo> getGroupWithAttr(Long catelogId);

    List<SkuItemVo.SpuItemAttrGroupVo> getAttrGroupWithAttrsBySpuId(Long spuId, Long catalogId);
}

